package cn.bonoon.kernel.menus;

import cn.bonoon.kernel.config.SortableItem;

public abstract class AbstractItemInfo extends SortableItem implements IItem, IShortcutInfo{
	protected String title;
	protected String href;
	protected IModuleInfo module;
	protected String navigation = "";
	/**
	 * 也许是未经过加密的id信息，也许是其它的值
	 */
	protected String key;

	private String iconCls;

	public String getIconCls() {
		return iconCls;
	}

	public void setIconCls(String iconCls) {
		this.iconCls = iconCls;
	}

	protected void _button(String href, StringBuilder a, String selected) {
		a.append("<a href='").append(href).append("' title='").append(title).append("' class='").append(selected).append("' ");
		__attrs(a);
		a.append(" id='mid_").append(id).append("' >");
//		a.append('>');
		buttonName(a);
		a.append("</a>");
	}

	public final boolean selected(String selected) {
		return id.equals(selected);
	}
	
	public abstract ChannelInfo getChannel();

	protected void __attrs(StringBuilder a){ }
	
	protected void buttonName(StringBuilder a){
		a.append(name);
	}

	public final IModuleInfo getModule() {
		return module;
	}
	
	public final String getTitle() {
		return title;
	}
	
	public final void setTitle(String title) {
		this.title = title;
	}

	public final String getHref() {
		return href;
	}

	public final String navigation(){ 
		return navigation; 
	}

	public String getKey() {
		return key;
	}

	public void setKey(String key) {
		this.key = key;
	}
}
